/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.transas.zorlog.data;

import java.text.NumberFormat;
import java.util.List;

/**
 * Abstract data source.
 * @author amalikov
 */
public abstract class DataSource {
	public abstract Object getHandle(String name);
	public abstract double getValue(Object handle, int index);
	public abstract String getValueAsString(Object handle, int index, NumberFormat nf);
	public abstract double[] getValues(String name);
	public abstract int getSize();
	public abstract List<String> getNames();
	public abstract String getAttribute(Object handle, String attrName);
	
	public final TimeSource getTimeSource() {
		return timeSource != null ? timeSource : new TimeSourceFromIndex(1, new TimeFormatterSimple());
	}
	
	public final void setTimeSource(TimeSource timeSource) {
		this.timeSource = timeSource;
	}
	
	private TimeSource timeSource;
}
